package controller;

import java.io.IOException;
import java.io.PrintWriter;
import java.util.Date;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
 
/**
 * Servlet implementation class ABCServlet
 */
@WebServlet("/ABCServlet")
public class ABCServlet extends HttpServlet {
	private static final long serialVersionUID = 1L;
       
    /**
     * @see HttpServlet#HttpServlet()
     */
    public ABCServlet() {
        super();
        // TODO Auto-generated constructor stub
    }
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    	// 设置请求编码格式
        request.setCharacterEncoding("UTF-8");
        // 设置响应编码格式
        response.setContentType("text/html;charset=UTF-8");
        // 手动设置响应行
        // 获取响应输出流
        PrintWriter writer = response.getWriter();
        // 生成HTML代码
        writer.append("<!DOCTYPE html>")
                .append("<html>")
                .append("<head>")
                .append("<title>HTTP响应</title>")
                .append("</head>")
                .append("<body>")
                .append("<h1>HTTP响应123</h1>")
                .append("</body>")
                .append("</html>");
    }

	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		response.getWriter().append("Served at: ").append(request.getContextPath());
	}

	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
	 */
	

}
